package(default_visibility=["//visibility:public"])

load("@angular//:index.bzl", "ng_package")
load("//:packages.bzl", "CDK_TARGETS", "ROLLUP_GLOBALS", "VERSION_PLACEHOLDER_REPLACEMENTS")
load("//tools:defaults.bzl", "ng_module")

# Export the CDK tsconfig so that subpackages can reference it directly.
exports_files(["tsconfig-build.json"])

# Root "@angular/cdk" entry-point that does not re-export individual entry-points.
ng_module(
  name = "cdk",
  srcs = glob(["*.ts"], exclude=["**/*.spec.ts"]),
  module_name = "@angular/cdk",
  deps = [
    "@angular//packages/core",
  ],
  tsconfig = ":tsconfig-build.json",
)

# Creates the @angular/cdk package published to npm.
ng_package(
  name = "npm_package",
  srcs = ["package.json"],
  entry_point = "src/cdk/public_api.js",
  globals = ROLLUP_GLOBALS,
  replacements = VERSION_PLACEHOLDER_REPLACEMENTS,
  deps = CDK_TARGETS,
  # TODO(devversion): Use the npm package for publishing. Right now this is disabled because
  # we build using AOT for serving & testing, but the `ng_package` rule should not include factory
  # files.
  tags = ["manual"],
)
